package com.glsc.ngateway.oaflow.controller;


import com.glsc.ngateway.common.api.oaflow.resp.CommonResponse;
import com.glsc.ngateway.common.base.domain.oracle.ecology.OaUserEmployInfo;
import com.glsc.ngateway.oaflow.service.OaUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;


@Deprecated
@RestController
@RequestMapping("/oauser")
public class OaUserController {

    @Autowired
    private OaUserService oaUserService;

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "/getOaUserList")
    public List<OaUserEmployInfo> getOaUserList(@RequestParam("statusList") String statusList) {
        logger.info("查询OA用户列表，状态是：{}", statusList);
        List<String> list = Arrays.stream(statusList.split(",")).collect(Collectors.toList());
        return oaUserService.getOaUserList(list);
    }


    @RequestMapping(value = "/getDepartmentInfoList", method = RequestMethod.POST)
    public CommonResponse getDepartmentInfoList(@RequestBody List<Integer> oaDepartmentIdList) {
        logger.info("查询OA用户列表，状态是：{}", oaDepartmentIdList);
        return CommonResponse.success(oaUserService.getDepartmentInfoList(oaDepartmentIdList));
    }


}
